import os

import pandas as pd


class DataOperate:
    def __init__(self, path):
        self.data = pd.read_csv(path)

    def get_data_tolist(self):
        return self.data.values.tolist()

    def get_data_to_dict(self):
        return [self.data.iloc[i].to_dict() for i in self.data.index.values]


if __name__ == '__main__':
    path1 = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
    path2 = os.path.join(path1, 'data/lj_data.csv')
    do = DataOperate(path2)
    # print(do.get_data_tolist())
    print(do.get_data_to_dict())
